﻿using SD.ContentSystem.IAppService.DTOs.Outputs;
using SD.Infrastructure.AppServiceBase;
using SD.Infrastructure.DTOBase;
using System;
using System.Collections.Generic;
using System.ServiceModel;

namespace SD.ContentSystem.IAppService.Interfaces
{
    /// <summary>
    /// 文章服务契约接口
    /// </summary>
    [ServiceContract(Namespace = "http://SD.CMS.IAppService.Interfaces")]
    public interface IArticleContract : IApplicationService
    {
        //命令部分

        #region # 创建文章 —— void CreateArticle(string channelNo, string title, string subTitle...
        /// <summary>
        /// 创建文章
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <param name="title">标题</param>
        /// <param name="subTitle">副标题</param>
        /// <param name="author">作者</param>
        /// <param name="source">来源</param>
        /// <param name="content">内容</param>
        /// <param name="imagePath">图片地址</param>
        /// <param name="thumbPath">缩略图</param>
        /// <param name="attachmentPath">附件</param>
        /// <param name="sort">排序</param>
        /// <param name="isTop">是否置顶</param>
        [OperationContract]
        void CreateArticle(string channelNo, string title, string subTitle, string author, string source, string content, string imagePath, string thumbPath, string attachmentPath, int sort, bool isTop);
        #endregion

        #region # 修改文章 —— void UpdateArticle(Guid articleId, string title, string subTitle...
        /// <summary>
        /// 修改文章
        /// </summary>
        /// <param name="articleId">文章Id</param>
        /// <param name="title">标题</param>
        /// <param name="subTitle">副标题</param>
        /// <param name="author">作者</param>
        /// <param name="source">来源</param>
        /// <param name="content">内容</param>
        /// <param name="imagePath">图片地址</param>
        /// <param name="thumbPath">缩略图</param>
        /// <param name="attachmentPath">附件</param>
        /// <param name="sort">排序</param>
        [OperationContract]
        void UpdateArticle(Guid articleId, string title, string subTitle, string author, string source, string content, string imagePath, string thumbPath, string attachmentPath, int sort);
        #endregion

        #region # 设置上一篇与下一篇 —— void SetPrevAndNextPage(Guid articleId...
        /// <summary>
        /// 设置上一篇与下一篇
        /// </summary>
        /// <param name="articleId">文章Id</param>
        /// <param name="prevPage">上一篇</param>
        /// <param name="nextPage">下一篇</param>
        [OperationContract]
        void SetPrevAndNextPage(Guid articleId, string prevPage, string nextPage);
        #endregion

        #region # 置顶文章 —— void SetArticleTop(Guid articleId)
        /// <summary>
        /// 置顶文章
        /// </summary>
        /// <param name="articleId">文章Id</param>
        [OperationContract]
        void SetArticleTop(Guid articleId);
        #endregion

        #region # 取消置顶文章 —— void CancelArticleTop(Guid articleId)
        /// <summary>
        /// 取消置顶文章
        /// </summary>
        /// <param name="articleId">文章Id</param>
        [OperationContract]
        void CancelArticleTop(Guid articleId);
        #endregion

        #region # 发布文章 —— void PublishArticle(Guid articleId)
        /// <summary>
        /// 发布文章
        /// </summary>
        /// <param name="articleId">文章Id</param>
        [OperationContract]
        void PublishArticle(Guid articleId);
        #endregion

        #region # 删除文章 —— void RemoveArticle(Guid articleId)
        /// <summary>
        /// 删除文章
        /// </summary>
        /// <param name="articleId">文章Id</param>
        [OperationContract]
        void RemoveArticle(Guid articleId);
        #endregion


        #region # 创建栏目 —— void CreateChannel(string channelNo, string channelName...
        /// <summary>
        /// 创建栏目
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <param name="channelName">栏目名称</param>
        /// <param name="storagePath">保存路径</param>
        /// <param name="indexTemplatePath">聚合页模板路径</param>
        /// <param name="listTemplatePath">列表页模板路径</param>
        /// <param name="detailTemplatePath">明细页模板路径</param>
        /// <param name="pageSize">页容量</param>
        /// <param name="sort">排序</param>
        /// <param name="isNavigator">是否是导航</param>
        /// <param name="description">描述</param>
        /// <param name="parentChannelId">上级栏目Id</param>
        [OperationContract]
        void CreateChannel(string channelNo, string channelName, string storagePath, string indexTemplatePath, string listTemplatePath, string detailTemplatePath, int pageSize, int sort, bool isNavigator, string description, Guid? parentChannelId);
        #endregion

        #region # 修改栏目 —— void UpdateChannel(Guid channelId, string channelName, string storagePath...
        /// <summary>
        /// 修改栏目
        /// </summary>
        /// <param name="channelId">栏目Id</param>
        /// <param name="channelName">栏目名称</param>
        /// <param name="storagePath">保存路径</param>
        /// <param name="indexTemplatePath">聚合页模板路径</param>
        /// <param name="listTemplatePath">列表页模板路径</param>
        /// <param name="detailTemplatePath">明细页模板路径</param>
        /// <param name="pageSize">页容量</param>
        /// <param name="sort">排序</param>
        /// <param name="isNavigator">是否是导航</param>
        /// <param name="description">描述</param>
        [OperationContract]
        void UpdateChannel(Guid channelId, string channelName, string storagePath, string indexTemplatePath, string listTemplatePath, string detailTemplatePath, int pageSize, int sort, bool isNavigator, string description);
        #endregion

        #region # 删除栏目 —— void RemoveChannel(Guid channelId)
        /// <summary>
        /// 删除栏目
        /// </summary>
        /// <param name="channelId">栏目Id</param>
        [OperationContract]
        void RemoveChannel(Guid channelId);
        #endregion


        //查询部分

        #region # 获取文章 —— ArticleInfo GetArticle(Guid articleId)
        /// <summary>
        /// 获取文章
        /// </summary>
        /// <param name="articleId">文章Id</param>
        /// <returns>文章</returns>
        [OperationContract]
        ArticleInfo GetArticle(Guid articleId);
        #endregion

        #region # 获取上一篇文章 —— ArticleInfo GetPrevArticle(Guid articleId...
        /// <summary>
        /// 获取上一篇文章
        /// </summary>
        /// <param name="articleId">文章Id</param>
        /// <param name="channelNo">栏目编号</param>
        /// <returns>文章</returns>
        [OperationContract]
        ArticleInfo GetPrevArticle(Guid articleId, string channelNo);
        #endregion

        #region # 获取下一篇文章 —— ArticleInfo GetNextArticle(Guid articleId...
        /// <summary>
        /// 获取下一篇文章
        /// </summary>
        /// <param name="articleId">文章Id</param>
        /// <param name="channelNo">栏目编号</param>
        /// <returns>文章</returns>
        [OperationContract]
        ArticleInfo GetNextArticle(Guid articleId, string channelNo);
        #endregion

        #region # 获取所有文章列表 —— IEnumerable<ArticleInfo> GetArticles()
        /// <summary>
        /// 获取所有文章列表
        /// </summary>
        /// <returns>文章列表</returns>
        [OperationContract]
        IEnumerable<ArticleInfo> GetArticles();
        #endregion

        #region # 分页获取文章列表 —— PageModel<ArticleInfo> GetArticlesByPage(string keywords...
        /// <summary>
        /// 分页获取文章列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="channelNo">栏目编号</param>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="pageIndex">页索引</param>
        /// <param name="pageSize">页容量</param>
        /// <returns>符合条件的文章记录条数</returns>
        [OperationContract]
        PageModel<ArticleInfo> GetArticlesByPage(string keywords, string channelNo, DateTime? startTime, DateTime? endTime, int pageIndex, int pageSize);
        #endregion

        #region # 根据栏目获取文章列表 —— IEnumerable<ArticleInfo> GetArticlesByChannel(...
        /// <summary>
        /// 根据栏目获取文章列表
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <returns>文章列表</returns>
        [OperationContract]
        IEnumerable<ArticleInfo> GetArticlesByChannel(string channelNo);
        #endregion

        #region # 根据栏目与数量获取文章列表 —— IEnumerable<ArticleInfo> GetArticlesByCount(...
        /// <summary>
        /// 根据栏目与数量获取文章列表
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <param name="count">数量</param>
        /// <returns>文章列表</returns>
        [OperationContract]
        IEnumerable<ArticleInfo> GetArticlesByCount(string channelNo, int count);
        #endregion


        #region # 获取栏目 —— ChannelInfo GetChannel(Guid channelId)
        /// <summary>
        /// 获取栏目
        /// </summary>
        /// <param name="channelId">栏目Id</param>
        /// <returns>栏目</returns>
        [OperationContract]
        ChannelInfo GetChannel(Guid channelId);
        #endregion

        #region # 获取栏目 —— ChannelInfo GetChannelByNo(string channelNo)
        /// <summary>
        /// 获取栏目
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <returns>栏目</returns>
        [OperationContract]
        ChannelInfo GetChannelByNo(string channelNo);
        #endregion

        #region # 获取栏目列表 —— IEnumerable<ChannelInfo> GetChannels(bool? isNavigator)
        /// <summary>
        /// 获取栏目列表
        /// </summary>
        /// <param name="isNavigator">是否是导航</param>
        /// <returns>栏目列表</returns>
        [OperationContract]
        IEnumerable<ChannelInfo> GetChannels(bool? isNavigator);
        #endregion

        #region # 根据上级栏目获取栏目列表 —— IEnumerable<ChannelInfo> GetChannelsByParent(string...
        /// <summary>
        /// 根据上级栏目获取栏目列表
        /// </summary>
        /// <param name="parentChannelNo">上级栏目编号</param>
        /// <param name="isNavigator">是否是导航</param>
        /// <returns>栏目列表</returns>
        [OperationContract]
        IEnumerable<ChannelInfo> GetChannelsByParent(string parentChannelNo, bool? isNavigator);
        #endregion

        #region # 获取栏目下文章条数/页数 —— KeyValuePair<int, int> GetArticlePageByChannel(...
        /// <summary>
        /// 获取栏目下文章条数/页数
        /// </summary>
        /// <param name="channelNo">栏目编号</param>
        /// <returns>栏目下文章条数/页数</returns>
        /// <remarks>KeyValuePair[int, int]，[条数, 页数]</remarks>
        [OperationContract]
        KeyValuePair<int, int> GetArticlePageByChannel(string channelNo);
        #endregion
    }
}
